// 表单配置项
{{$lens := .table.Columns|len}}
export const formOptions = (code) => {
    switch(code){
        case "defaultForm":
            return {
              {{range $index, $column := .table.Columns}}
                  {{if eq $column.HtmlType "radio"}}
                      {{$column.HtmlField}}: "0",
                        {{else if eq $column.HtmlType "checkbox"}}
                      {{$column.HtmlField}}: [],
                        {{else}}
                      {{$column.JavaField}}: undefined,
                        {{end}}
              {{end}}
            }
        case "options" :
            return [{{range $index, $column := .table.Columns}}
                        {{if and (eq $column.IsInsert "1") (ne $column.IsPk "1")}}
                            {{if eq $column.HtmlType "input"}}
                                { 'type': 'input', 'label': '{{$column.ColumnComment}}', 'prop': '{{$column.JavaField}}', clearable: true,col: 8, 'maxlength': {{$column.ColumnLength}}, },
                            {{else if eq $column.HtmlType "radio" }}
                                {{if ne $column.DictType ""}}
                                    { 'type': 'radio', 'label': '{{$column.ColumnComment}}', 'prop': '{{$column.JavaField}}',clearable: true, col: 8, extraProps:{options:{{$column.HtmlField}}Options} },
                                {{else}}

                                {{end}}
                            {{else if eq $column.HtmlType "textarea"}}
                                    { 'type': 'textarea', 'label': '{{$column.ColumnComment}}', 'prop': '{{$column.JavaField}}', col: 8,'maxlength': {{$column.ColumnLength}}, extraProps:{autosize: { minRows: 3, maxRows: 4 }} },
                            {{else if eq $column.HtmlType "richtext"}}
                                    { 'type': 'richtext', 'label': '{{$column.ColumnComment}}', 'prop': '{{$column.JavaField}}','maxlength': {{$column.ColumnLength}}, col: 8 },
                            {{end}}
                        {{end}}
                    {{end}}]
        case "rules" :
            return {
               {{range $index, $column := .table.Columns}}{{if eq $column.IsRequired "1"}}
              {{$column.JavaField}}: [
                {
                  required: true,
                  message: "{{$column.ColumnComment}}不能为空",
                  trigger: "blur"
                },
              ]{{if ne $lens $index}},{{end}}{{end}}{{end}}
            }
}
}
// 列表配置项
export const columnOptions = () => {
    switch (code) {
        case "grids" :
            return  [
              {{range $index, $column := .table.Columns}}
                { 'headerName': '{{$column.ColumnComment}}', 'field': '{{$column.JavaField}}', 'tooltipField': '{{$column.JavaField}}', 'width': 250 },
              {{end}}
             ]
}
}